package com.github.gdxmap.layer;

import com.badlogic.gdx.graphics.g2d.PolygonSpriteBatch;
import com.badlogic.gdx.graphics.glutils.ShapeRenderer;

/**
 * Created by free on 2016/12/6 0006.
 */
public abstract class Layer {
    //地图id
    private String id;
    //地图tag
    private String tag;
    //地图序号
    private int index;

    protected PolygonSpriteBatch polygonSpriteBatch;

    public abstract void render();

    protected float moveX;
    protected float moveY;
    protected float scale;

    public void scale(float scale){
        this.scale=scale;

        this.onScale(scale);
    }

    /**
     * 缩放回调
     * @param scale 缩放等级
     */
    public void onScale(float scale){

    }

    /**
     * 移动
     * @param fx
     * @param fy
     */
    public void move(float fx,float fy){
        this.moveX=fx;
        this.moveY=fy;

        this.onMove();
    }
    /**
     * 图层移动回调
     */
    public void onMove(){

    }

    /**
     * 加入渲染队列
     */
    public void addRender(){

    }

    /**
     * 退出渲染队列
     */
    public void exitRender(){

    }

    public PolygonSpriteBatch getPolygonSpriteBatch() {
        return polygonSpriteBatch;
    }

    public void setPolygonSpriteBatch(PolygonSpriteBatch polygonSpriteBatch) {
        this.polygonSpriteBatch = polygonSpriteBatch;
    }
}
